<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>照片墙</title>
    <base href="<?php echo base_url(); ?>"/>
    <link href="style/base.css" rel="stylesheet" type="text/css"/>
    <link href="style/common.css" rel="stylesheet" type="text/css"/>
    <link href="style/zhanshi.css" rel="stylesheet" type="text/css"/>
    <link href="style/pubuliu.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="style/jquery.fancybox.css" media="screen" />
    <script src="js/jquery-1.7.2.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="js/jquery.enplaceholder.js"></script>
    <script type="text/javascript" src="js/jquery.fancybox.js"></script>
    <script type="text/javascript" language="javascript">
        // 文本框placeholder效果,给input加上类ph,使其支持placeholder效果
        $(function () {
            $('input.ph').placeholder({isUseSpan: true});
        })
        // 登陆条固定效果
        $(function () {
            if ($("#login_zc").length > 0 && ($("#login_zc").css("display") != "none")) {
                $("body").css("padding-bottom", "135px");
            }

            $("#login_close").click(function () {
                $("#login_zc").hide();
                $("body").css("padding-bottom", "0");
            })
        })
    </script>
    <!--[if IE 6]>
    <script type="text/javascript" language="javascript" src="js/ie6/DD_belatedPNG_0.0.8a-min.js"></script>
    <script type="text/javascript" language="javascript">
        DD_belatedPNG.fix('.logo img,.footer_logo img');
    </script>
    <![endif]-->
    <script type="text/javascript" src="js/jquery.masonry.js"></script>
    <script type="text/javascript" src="js/jquery.infinitescroll.js"></script>
    <script type="text/javascript">

        function item_masonry() {
            $('.item img').load(function () {
                $('.infinite_scroll').masonry({
                    itemSelector: '.masonry_brick',
                    columnWidth: 226,
                    gutterWidth: 15
                });
            });

            $('.infinite_scroll').masonry({
                itemSelector: '.masonry_brick',
                columnWidth: 226,
                gutterWidth: 15
            });
        }

        $(function () {

            function item_callback() {

                $('.item').mouseover(function () {
                    $(this).css('box-shadow', '0 1px 5px rgba(35,25,25,0.5)');
                    $('.btns', this).show();
                }).mouseout(function () {
                        $(this).css('box-shadow', '0 1px 3px rgba(34,25,25,0.2)');
                        $('.btns', this).hide();
                    });

                item_masonry();

            }

            item_callback();

            $('.item').fadeIn();

            var sp = 1

            $(".infinite_scroll").infinitescroll({
                navSelector: "#more",
                nextSelector: "#more a",
                itemSelector: ".item",

                loading: {
                    img: "images/masonry_loading_1.gif",
                    msgText: ' ',
                    finishedMsg: '木有了',
                    extraScrollPx: 250,
                    animate: true,
                    dataType: 'html',//可以是json
                    finished: function () {
                        sp++;
                        if (sp >= 10) { //到第10页结束事件
                            $("#more").remove();
                            $("#infscr-loading").hide();
                            $("#page").show();
                            $(window).unbind('.infscr');
                        }
                    }
                }, errorCallback: function () {
                    //$("#page").show();
                }

            }, function (newElements) {
                var $newElems = $(newElements);
                $('.infinite_scroll').masonry('appended', $newElems, false);
                $newElems.fadeIn();
                item_callback();
                return;
            });

            $('.fancybox-effects-b').fancybox({
                openEffect: 'none',
                closeEffect: 'none',

                helpers:{
                    title:{
                        type: 'over'
                    }
                }

            });
        });
        function markerLike(photoId,obj)
        {
            var uid = $('#uid').val();
            if(uid <= 0){
                $("#login_zc").css("display","block");
            }else{
                var params = {photoId:photoId};
                $.ajax({
                    type:"post",
                    url:"index.php/login/markLike",
                    dataType:"json",
                    data:params,
                    success:function(data){
                        if(data.statusCode ==1){
                            alert(data.msg);
                            var likeNum = parseInt($(obj).next("em").html());
                            $(obj).next("em").html(likeNum+1);
                        }else if(data.statusCode ==2){
                            alert(data.msg);
                        }else{
                            alert('失败');
                        }
                    }
                })
            }
        }
    </script>
    <style type="text/css">
        .fancybox-custom .fancybox-skin {
            box-shadow: 0 0 50px #222;
        }
    </style>
</head>
<body>
<input type="hidden" value="<?php if(isset($this->session->userdata['id'])) echo $this->session->userdata['id']; else echo '0';?>" id="uid" />
<!-- head S-->
<?php
include 'header.php';
?>
<!-- head E-->
<!-- 名片 S -->
<?php
include 'person_info.php';
?>
<!-- 名片 E -->
<!-- 选项卡 S -->
<?php
include 'home_nav.php';
?>
<!-- 选项卡 E -->
<!-- 照片墙 S -->
<div class="demo clearfix">
    <div class="item_list infinite_scroll">
        <?php foreach ($data['data'] as $item): ?>
            <div class="item masonry_brick">
                <div class="item_t">
                    <div class="img">
                        <a href="<?php echo base_url().'uploads/'.$item['url']; ?>" class="fancybox-effects-b"><img width="210" alt="js lazyload实现网页图片延迟加载特效" src="<?php echo base_url().'uploads/'.$item['url']; ?>"/></a>
                    </div>
                    <div class="title"><span></span></div>
                </div>
                <div class="item_b clearfix">
                    <div class="items_likes fl">
                        <a href="javascript:;" class="like_btn"  onclick="markerLike(<?php echo $item['id']; ?>,this);"></a>
                        <em class="bold"><?php echo $item['like_count'];?></em>
                    </div>
                </div>
            </div>
        <?php endforeach; ?>

        <!--item end-->
    </div>

    <div id="more"><a href="index.php/login/ajaxAllPhono?pageNum=<?php echo $pageNum; ?>"></a></div>

    <!--<div id="page" class="page" style="display:none;">
		<div class="page_num">
			<?php /*echo $pageHtml;*/?>
			<a href="" class="next"></a>
		</div>
	</div>-->

</div>

<div style="display:none;" id="gotopbtn" class="to_top"><a title="返回顶部" href="javascript:void(0);"></a></div>


<script type="text/javascript">
    $(function () {

        $(window).scroll(function () {
            $(window).scrollTop() > 1000 ? $("#gotopbtn").css('display', '').click(function () {
                $(window).scrollTop(0);
            }) : $("#gotopbtn").css('display', 'none');
        });

    });
</script>
<!-- 照片墙 E -->

<!-- 登录 S-->

    <div class="login_zc login_zc_bg2" id="login_zc" <?php if (isset($this->session->userdata['id'])) { ?> style="display: none;" <?php }?>>
        <div class="login_zc_inner">
            <div class="form">
                <form action="" method="">
                    <input type="text" class="form_text ph" placeholder="手机号/邮箱" value=""/>
                    <input type="password" class="form_text ph" placeholder="登录密码" value=""/>
                    <input type="submit" class="form_login" value="登 录"/>
                    <a href="" class="btn_regedit">注 册</a>
                </form>
            </div>
            <ul>
                <li class="btn_login_weibo"><a href="#">微博账号登录</a></li>
                <li class="btn_login_qq"><a href="#">QQ账号登录</a></li>
                <li class="txt"><img src="images/txt_zcjks.png"/></li>
            </ul>
            <a href="javascript:void(0)" class="btn_close" id="login_close"></a>
        </div>
    </div>
<!-- 登录 E-->

<!-- 底部 S -->
<?php include 'footer.php'; ?>
<!-- 底部 E -->
</body>
</html>
